package com.qf.smsplatform.controller;
/*2021/10/29*/

import com.github.pagehelper.PageInfo;
import com.qf.smsplatform.dto.R;
import com.qf.smsplatform.pojo.TNotify;
import com.qf.smsplatform.service.TNotifyService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @YuTao
 */

@RequestMapping("/notify")
@RestController
@Api(tags = "通知表管理")
public class TNotifyController {

    private TNotifyService notifyService;
    @Autowired
    public void setNotifyService(TNotifyService notifyService) {
        this.notifyService = notifyService;
    }
    @PostMapping("/update")
    @ApiOperation("更新通知信息")
    public R updateNotify(@RequestBody TNotify tNotify){
        notifyService.updateNotify(tNotify);
        return R.setOk();
    }
    @PostMapping("/insert")
    @ApiOperation("添加一条数据信息")
    public R insertNotify(@RequestBody TNotify tNotify){
        notifyService.insertTNotify(tNotify);
        return R.setOk();
    }
    @DeleteMapping("/delete")
    @ApiOperation("删除一条通知信息")
    public R deleteNotify(String tag){
        notifyService.deleteTNotify(tag);
        return R.setOk();
    }

    @PostMapping("/page")
    @ApiOperation("分页查询")
    public R seletPage(int pageNum,int pageSize){

        PageInfo<TNotify> pageInfo = notifyService.selectPage(pageNum, pageSize);
        return R.setOk(pageInfo);

    }

}
